package com.gzcstec.dao;

import com.gzcstec.domain.HostStat;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

/**
 * 站点统计dao类
 */
@Mapper
@Repository
public interface HostStatDao {

    @Select("select stat_id,host_id,open_id,count from host_stat where open_id = #{openId} and host_id = #{hostId}")
    HostStat getStatByOpenIdAndHostId(@Param("openId")String openId , @Param("hostId")String hostId);

    @Insert("insert into host_stat(stat_id,host_id,open_id,count) values(#{statId},#{hostId},#{openId},#{count})")
    int addHostStat(HostStat hostStat);

    @Update("update host_stat set count=count+1 where stat_id = #{statId}")
    int incHostStat(@Param("statId")String statId);

}
